program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  pelement=^element;
  element=record
    value:integer;
    next:pelement
  end;

procedure add(head:pelement; num:integer);
var
  tmp:pelement;
begin
  tmp:=head;
  new(head);
  head^.next:=tmp;
  head^.value:=num;
end;

procedure addtoend(head:pelement; num integer);
var
  current:pelement;
begin
  current:=head;
  while(current^.next<>nil) do
  begin
    current:=current^.next;
  end;
  new(current^.next);
  current^.next^.value:=num;
  current^.next^.next:=nil;
  end
  else begin
    add(head; num);
  end;
  end;

procedure printlist(head:pelement);
var
  current:pelement;
begin
  current:=head;
  while (current<>nil) do
  begin
    writeln(current^.value);
    current:=current^.next;
  end;
end;

var
  j, a, n : integer;
  head, all : pelement;
  fin : textfile;

begin
  assignfile(fin, 'input.txt');
  reset(fin);
  readln(fin, n);
  for j:=0 to n do
    begin
    read(fin ,a);
    add(head ,a);
  end;
  printlist(head);
  readln;



end.
